<?php
include_once 'field.class.php';

class field_upload extends field
{
    protected $fieldname = '文件';
    /**
     * 生成设置项
     * @author menghao
     * @param <string> $data
     * @return <string>
     */
    function settings($data='')
    {
        $data = unserialize($data);
        $data['size'] = isset($data['size']) && is_numeric ($data['size']) ? $data['size'] : 50;

        $setting = '';
        $setting .= '<label>文件大小(KB)：'.form::text('settings[size]', 'setting_size', $data['size'], 7).'</label> ';

        return $setting;
    }

    function create_form($value='')
    {
        $field = $this->field_data['field'];
        return form::file("data[$field]", $field, $value);
    }

}
?>